﻿/**
 * 
 * Copyright 2009, 2010 Mike Jamer [email: mikejamer@gmail.com ]
 * 
 * This File is part of Moose IRC
 * 
 * MooseIRC is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * MooseIRC is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with MooseIRC.  If not, see <http://www.gnu.org/licenses/>.
 * 
 */

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using moose;
using mooseirc.client.windowsforms;

namespace mooseirc.client.windowsforms {

    /// <summary>
    /// Options Form is used to allow user to tweak certain settings 
    /// for the client.
    /// </summary>
    public partial class OptionsForm : Form {

        #region [Construction]

        /// <summary>
        /// Initialize Options Form
        /// </summary>
        public OptionsForm() {
            InitializeComponent();
            load();
            return;
        }

        #endregion

        #region [Load Data]

        /// <summary>
        /// Load Options from the XML file
        /// </summary>
        private void load() {
            //General Tab
            txtNickname.Text = Settings.get(Properties.Resources.Setting_General_Identity_Nickname);
            txtAltNickname.Text = Settings.get(Properties.Resources.Setting_General_Identity_Alt_Nickname);
            txtUsername.Text = Settings.get(Properties.Resources.Setting_General_Identity_UserName);
            txtRealName.Text = Settings.get(Properties.Resources.Setting_General_Identity_Realname);
            chkInvisibleMode.Checked = bool.Parse(Settings.get(Properties.Resources.Setting_General_Identity_Invisible));
            return;
        }

        #endregion

        #region [Save Data]

        /// <summary>
        /// Saves Options from general tab
        /// </summary>
        private void save() {
            //General Tab
            Settings.set(Properties.Resources.Setting_General_Identity_Nickname, txtNickname.Text);
            Settings.set(Properties.Resources.Setting_General_Identity_Alt_Nickname, txtAltNickname.Text);
            Settings.set(Properties.Resources.Setting_General_Identity_UserName, txtUsername.Text);
            Settings.set(Properties.Resources.Setting_General_Identity_Realname, txtRealName.Text);
            Settings.set(Properties.Resources.Setting_General_Identity_Invisible, chkInvisibleMode.Checked.ToString());
            return;
        }

        #endregion

        #region [Form Events]

        /// <summary>
        /// User Exitgs
        /// </summary>
        private void cmdOK_Click(object sender, EventArgs e) {
            save();
            Close();
            return;
        }

        #endregion

    }
}
